package com.rayo.accesscontrollercopy.model.db.dao;


import com.rayo.accesscontrollercopy.model.db.DbHelp;
import com.rayo.accesscontrollercopy.model.db.bean.BlackListData;

import java.util.List;

/**
 * Created by yanghaojie on 16/7/27.
 */
public class BlackListImpl implements BlackListDao {
    @Override
    public boolean isKeyInBlack(int id) {
        return false;
    }

    @Override
    public boolean isCardInBlack(int id) {
        return false;
    }

    @Override
    public void updateBlackList(BlackListData data) {
        List<BlackListData> list = DbHelp.getQueryAll(BlackListData.class);
        if (null == list || list.size() == 0) {
            DbHelp.insert(data);
        } else {
            BlackListData temp = list.get(0);
            temp.setKey(data.getKey());
            temp.setCard(data.getCard());
            DbHelp.update(temp);
        }
    }
}
